import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import Info from '@/views/Info'
import My from '@/views/My'
import Login from '@/views/Login'
import Map from '@/views/Map'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/home'
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      {
        path: '/layout/home',
        component: Home,
        name: Home
      },
      {
        path: '/layout/search',
        component: Search
      }, {
        path: '/layout/info',
        component: Info
      }, {
        path: '/layout/my',
        component: My
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/map',
    component: Map
  }
]

const router = new VueRouter({
  routes
})

export default router
